package com.usian.article.controller.v1;

import com.usian.apis.article.ApArticleControllerApi;
import com.usian.article.service.ApArticleService;
import com.usian.model.article.pojos.ApArticle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName: ApArticleController
 * Author:   WGG
 * Date:    2022-11-2022/11/23-18:26
 * Version: 1.0
 * Description:
 */
@RestController
@RequestMapping("/article/api/v1/article")
public class ApArticleController implements ApArticleControllerApi {
    @Autowired
    private ApArticleService apArticleService;

    @Override
    @PostMapping("/saveArticle")
    public ApArticle saveArticle(@RequestBody ApArticle apArticle) {
        return apArticleService.saveArticle(apArticle);
    }

    @Override
    @GetMapping("/findById/{id}")
    public ApArticle findById(@PathVariable("id") Long id) {
        return apArticleService.findById(id);
    }


    @GetMapping("/findArticle")
    public List<ApArticle> findArticle(){
        return apArticleService.list();
    }
}
